package com.wy.about_attributes.demo1;

/**
 * @author 美女
 * @date 2022/04/20 09:30
 **/
public class Main3 {
    static class MyThread extends Thread{
//        public MyThread(){
//            setName("我是xxx");
//        }
        //调用Thread类提供的构造方法
        public MyThread(String name){
            super(name);
        }
        @Override
        public void run() {
            System.out.println(this.getName());
        }
    }
    public static void main(String[] args) {
        Thread thread=Thread.currentThread();//当前线程
        System.out.println(thread.getName());
        MyThread t1=new MyThread("我是t1");
        t1.setName("我又改名字了");
        t1.start();
        MyThread t2=new MyThread("我是t2");
        t2.start();
    }
}
